﻿using Abp.Extensions;
using Abp.Collections.Extensions;
using Abp.Runtime.Validation;
using System.Collections.Generic;

namespace Mt.Site.Application.Authorization.Roles.Dto
{
    public class GetRolesInput: IShouldNormalize
    {
        //过渡，等ui修改后移除
        public string Permission { get; set; }
        //过渡，等ui修改后移除
        public string MenuPermission { get; set; }

        public List<string> Permissions { get; set; }

        public List<string> MenuPermissions { get; set; }

        public void Normalize()
        {
            if (!Permission.IsNullOrEmpty())
            {
                if (Permissions.IsNullOrEmpty())
                {
                    Permissions = new List<string> { Permission };
                }
                else
                {
                    Permissions.Add(Permission);
                }
            }

            if (!MenuPermission.IsNullOrEmpty())
            {
                if (MenuPermissions.IsNullOrEmpty())
                {
                    MenuPermissions = new List<string> { MenuPermission };
                }
                else
                {
                    MenuPermissions.Add(MenuPermission);
                }
            }
        }
    }
}
